<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <link href="/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
    <title>后台登录 </title>
    <script src="/jquery/jquery-3.2.1.min.js"></script>
    <script src="/layer/layer.js"></script>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <script type="text/javascript" src="/layui/layui.js"></script>


</head>
<body>
<div class="header">
    <h1> 后台管理系统</h1>
</div>
<div class="loginWraper">
    <div id="loginform" class="loginBox">
        <form class="form form-horizontal" id="form">
            <?php echo e(csrf_field()); ?>

            <div class="row cl">
                <label class="form-label col-xs-3 col-ms-3" style="line-height: 36px;font-size: 20px;">帐号</label>
                <div class="formControls col-xs-6 col-ms-6">
                    <input name="account" type="text" placeholder="帐号" class="input-text size-L" datatype="*" nullmsg="请填写帐号">
                </div>
                <div class="col-xs-3 col-ms-3"></div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-3 col-ms-3" style="line-height: 40px;font-size: 20px;">密码</label>
                <div class="formControls col-xs-6 col-ms-6">
                    <input name="password" type="password" placeholder="密码" class="input-text size-L" datatype="*" nullmsg="请填写密码">
                </div>
                <div class="col-xs-3 col-ms-3"></div>
            </div>
            <div class="row cl">
                <div class="formControls col-xs-6 col-ms-6 col-xs-offset-3 col-ms-offset-3">
                    <input name="captcha" class="input-text size-L" type="text" placeholder="验证码" style="width:100px;min-width: auto" datatype="*" nullmsg="请填写验证码">
                    <img id="captcha" src="captcha/1" alt="验证码" title="点击刷新验证码" style="cursor:pointer;width: 150px;height: 40px">
                </div>
                <div class="col-xs-3 col-ms-3"></div>
            </div>
            
                
                    
                        
                        
                    
                
            
            <div class="row cl">
                <div class="formControls col-xs-6 col-xs-offset-3">
                    <input name="" id="login" type="button" class="btn btn-success radius size-L mr-20" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
                    <input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;重&nbsp;&nbsp;&nbsp;&nbsp;置&nbsp;">
                </div>
            </div>
        </form>
    </div>
</div>
<div class="footer">zhangxuannneg工作室 为您服务</div>

<script>
    function getRandom(n){
        return Math.floor(Math.random()*n+1)
    }
    $("#captcha").click(function () {
        var data = getRandom(9);
        var src = "captcha/"+data;
        $(this).attr('src',src);
    });
    $("#login").click(function () {
       $.post('verification',$('#form').serialize(),function (res) {
           if(res==200){
               layer.msg('登录成功');
               location.href = 'index';
           }else if(res==404){
               layer.msg('账号不存在');
           }else if(res==403){
               layer.msg('密码错误');
           }else if(res==402){
               layer.msg('验证码错误');
               var data = getRandom(9);
               var src = "captcha/"+data;
               $("#captcha").attr('src',src);
           }
       })
    });
</script>
</body>
</html>